package codechicken.wirelessredstone.core;

import net.minecraft.src.TileEntity;

public class BlockCoord implements Comparable<BlockCoord>
{
	public BlockCoord(int x, int y, int z)
	{
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public BlockCoord(TileEntity tile)
	{
		this(tile.xCoord, tile.yCoord, tile.zCoord);
	}

	public int compareTo(BlockCoord node2)
	{
		if(x == node2.x)
		{
			if(z == node2.z)
			{
				if(y == node2.y)
				{
					return 0;
				}
				else
				{
					return y < node2.y ? -1 : 1;
				}
			}
			else
			{
				return z < node2.z ? -1 : 1;
			}
		}
		else
		{
			return x < node2.x ? -1 : 1;
		}
	}
	
	public String toString()
	{
		return "["+x+","+y+","+z+"]";
	}
	
	public int x;
	public int y;
	public int z;
}
